package com.example.web ;

import com.example.service.ActorService;
import com.example.model.Actor;
import com.example.model.query.ActorExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created on 2017/12/26 18:50
 */
@RestController
@RequestMapping(value = "/actor")
public class ActorController {

	@Autowired
	private ActorService actorService;


	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	public Actor selectByPrimaryKey(@PathVariable("id") Short id) {
		return actorService.selectByPrimaryKey(id);
	}

	@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
	public void deleteByPrimaryKey(@PathVariable("id") Short id) {
        actorService.deleteByPrimaryKey(id);
	}

    @RequestMapping(value = "/", method = RequestMethod.POST)
    public void insertSelective(@RequestBody Actor actor) {
        actorService.insertSelective(actor);
    }

	@RequestMapping(value = "/", method = RequestMethod.PUT)
	public void updateByPrimaryKeySelective(@RequestBody Actor actor) {
        actorService.updateByPrimaryKeySelective(actor);
	}

}